gtkplacessidebar: Add loop devices
authorsegfault3 <segfault@riseup.net>
Fri, 5 Apr 2019 19:58:56 +0000 (19:58 +0000)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 5 Apr 2019 19:58:56 +0000 (19:58 +0000)
gtk/gtkplacessidebar.c

index 03d2e7f5235fe710d460a681c85e9b340b9d6877..91d7179161d6d44236c96663b86b5a0bef861ff2 100644 (file)
@@ -1280,10 +1280,13 @@ update_places (GtkPlacesSidebar *sidebar)
     }
   g_list_free_full (drives, g_object_unref);
 
-  /* add all network volumes that is not associated with a drive */
+  /* add all network volumes that are not associated with a drive, and
+   * loop devices
+   */
   volumes = g_volume_monitor_get_volumes (sidebar->volume_monitor);
   for (l = volumes; l != NULL; l = l->next)
     {
+      gboolean is_loop = FALSE;
       volume = l->data;
       drive = g_volume_get_drive (volume);
       if (drive != NULL)
@@ -1301,9 +1304,13 @@ update_places (GtkPlacesSidebar *sidebar)
           network_volumes = g_list_prepend (network_volumes, volume);
           continue;
         }
+      else if (g_strcmp0 (identifier, "loop") == 0)
+        is_loop = TRUE;
       g_free (identifier);
 
-      if (sidebar->show_other_locations && !is_external_volume (volume))
+      if (sidebar->show_other_locations &&
+          !is_external_volume (volume) &&
+          !is_loop)
         {
           g_object_unref (volume);
           continue;